package com.mp.chart.markerview;

import android.content.Context;
import android.widget.TextView;

import com.mp.chart.components.MarkerView;
import com.mp.chart.data.Entry;
import com.mp.chart.data.MinutesData;
import com.android.R;

import java.text.DecimalFormat;

public class TopMarkerView extends MarkerView {

    private final boolean isOut;
    private DecimalFormat mFormat;
    private TextView tvContent;
    private float volume;
    private String type;//com.mp.chart type

    public TopMarkerView(String type, Context context, int layoutResource, boolean isOut, float maxVolume) {
        super(context, layoutResource);
        this.type = type;
        this.isOut = isOut;
        this.volume = maxVolume;
        tvContent = (TextView) findViewById(R.id.tvContent);
        tvContent.setTextColor(getResources().getColor(R.color.main_white));


    }

    @Override
    public void refreshContent(Entry e, int dataSetIndex) {
        if ("kline".equals(type)) {

                tvContent.setText(volume + "");

        } else if ("timeline".equals(type)) {
            MinutesData data = (MinutesData) e.getData();
            if (data != null) {
                    tvContent.setText(mFormat.format(data.chengjiaojia));
            } else {
                tvContent.setText("");
            }
        }
    }

    @Override
    public int getXOffset() {
        return 0;
    }

    @Override
    public int getYOffset() {
        return 0;
    }

//    public void setData(List<String> quoteInfoList){
//        markerTv1.setText(quoteInfoList.get(1));
//        PriceColorUtil.setPriceColor(markerTv2,Double.parseDouble(quoteInfoList.get(2)),Double.valueOf(quoteInfoList.get(0)));
//        PriceColorUtil.setPriceColor(markerTv3,Double.parseDouble(quoteInfoList.get(3)),Double.valueOf(quoteInfoList.get(0)));
//        markerTv4.setText(quoteInfoList.get(4)+"%");
//        PriceColorUtil.setPercentColor(markerTv4, Double.parseDouble(quoteInfoList.get(4)));
//    }

}
